home *** CD-ROM | disk | FTP | other *** search
/ Aminet 40 / Aminet 40 (2000)(Schatztruhe)[!][Dec 2000].iso / Aminet / dev / lang / Python16_Src.lha / Python16_Source / Include / methodobject.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-08-03  |  1.8 KB  |  66 lines

  1. #ifndef Py_METHODOBJECT_H
  2. #define Py_METHODOBJECT_H
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6.  
  7. /* Method object interface */
  8.  
  9. extern DL_IMPORT(PyTypeObject) PyCFunction_Type;
  10.  
  11. #define PyCFunction_Check(op) ((op)->ob_type == &PyCFunction_Type)
  12.  
  13. typedef PyObject *(*PyCFunction) Py_FPROTO((PyObject *, PyObject *));
  14. typedef PyObject *(*PyCFunctionWithKeywords)
  15.     Py_FPROTO((PyObject *, PyObject *, PyObject *));
  16.  
  17. extern DL_IMPORT(PyCFunction) PyCFunction_GetFunction Py_PROTO((PyObject *));
  18. extern DL_IMPORT(PyObject *) PyCFunction_GetSelf Py_PROTO((PyObject *));
  19. extern DL_IMPORT(int) PyCFunction_GetFlags Py_PROTO((PyObject *));
  20.  
  21. /* Macros for direct access to these values. Type checks are *not*
  22.    done, so use with care. */
  23. #define PyCFunction_GET_FUNCTION(func) \
  24.         (((PyCFunctionObject *)func) -> m_ml -> ml_meth)
  25. #define PyCFunction_GET_SELF(func) \
  26.     (((PyCFunctionObject *)func) -> m_self)
  27. #define PyCFunction_GET_FLAGS(func) \
  28.     (((PyCFunctionObject *)func) -> m_ml -> ml_flags)
  29.  
  30. struct PyMethodDef {
  31.     char        *ml_name;
  32.     PyCFunction    ml_meth;
  33.     int        ml_flags;
  34.     char        *ml_doc;
  35. };
  36. typedef struct PyMethodDef PyMethodDef;
  37.  
  38. extern DL_IMPORT(PyObject *) Py_FindMethod
  39.     Py_PROTO((PyMethodDef[], PyObject *, char *));
  40.  
  41. extern DL_IMPORT(PyObject *) PyCFunction_New
  42.     Py_PROTO((PyMethodDef *, PyObject *));
  43.  
  44. /* Flag passed to newmethodobject */
  45. #define METH_VARARGS  0x0001
  46. #define METH_KEYWORDS 0x0002
  47.  
  48. typedef struct PyMethodChain {
  49.     PyMethodDef *methods;        /* Methods of this type */
  50.     struct PyMethodChain *link;    /* NULL or base type */
  51. } PyMethodChain;
  52.  
  53. extern DL_IMPORT(PyObject *) Py_FindMethodInChain
  54.     Py_PROTO((PyMethodChain *, PyObject *, char *));
  55.  
  56. typedef struct {
  57.     PyObject_HEAD
  58.     PyMethodDef *m_ml;
  59.     PyObject    *m_self;
  60. } PyCFunctionObject;
  61.  
  62. #ifdef __cplusplus
  63. }
  64. #endif
  65. #endif /* !Py_METHODOBJECT_H */
  66.